package com.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.utils.PageUtils;


import com.dao.WeixiuhuifuDao;
import com.domain.entity.WeixiuhuifuEntity;
import com.service.WeixiuhuifuService;

@Service("weixiuhuifuService")
public class WeixiuhuifuServiceImpl extends ServiceImpl<WeixiuhuifuDao, WeixiuhuifuEntity> implements WeixiuhuifuService {

    @Autowired
    private WeixiuhuifuDao weixiuhuifuDao;

    @Override
    public PageUtils queryPage(int pageNum, int pageSize, WeixiuhuifuEntity weixiuhuifu) {

        EntityWrapper<WeixiuhuifuEntity> wrapper = new EntityWrapper<>();

        if (StringUtils.isNotEmpty(weixiuhuifu.getDianzhuangbianhao())){
            wrapper.like("dianzhuangbianhao", weixiuhuifu.getDianzhuangbianhao());
        }

        if (StringUtils.isNotEmpty(weixiuhuifu.getDianzhuangleibie())){
            wrapper.like("dianzhuangleibie", weixiuhuifu.getDianzhuangleibie());
        }

        if (StringUtils.isNotEmpty(weixiuhuifu.getSuochuweizhi())){
            wrapper.like("suochuweizhi", weixiuhuifu.getSuochuweizhi());
        }

        if (StringUtils.isNotEmpty(weixiuhuifu.getWeixiuzhuangtai())){
            wrapper.like("weixiuzhuangtai", weixiuhuifu.getWeixiuzhuangtai());
        }

        Page<WeixiuhuifuEntity> page = new Page<>();
        page.setRecords(weixiuhuifuDao.selectPage(page, wrapper));
        return new PageUtils(page);
    }
}
